package com.cx.controller.admin.basic;

import com.cx.service.admin.basic.ChainBasicPrivilegeManager;
import com.cx.service.admin.basic.ChainBasicPrivilegeRoleManager;
import org.cx.base.ApiModel;
import org.cx.base.BaseController;
import org.cx.entity.Page;
import org.cx.entity.PageData;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController("admin/basic/privilegeRole")
@RequestMapping("admin/basic/privilegeRole")
public class PrivilegeRoleController extends BaseController {

    @Resource
    private ChainBasicPrivilegeRoleManager chainBasicPrivilegeRoleService;


    @ResponseBody
    @RequestMapping(value = "/findPrivilegeRoleDetailPage")
    public ApiModel findPrivilegeRoleDetailPage() throws Exception {
        Page pg =this.getPage();
        List<PageData> list = chainBasicPrivilegeRoleService.findPrivilegeRoleDetailPage(pg);
        pg.setPd(list);
        return buildSuccMsg(pg);
    }

    @ResponseBody
    @RequestMapping(value = "/findPrivilegeRoleByPageDate")
    public ApiModel findPrivilegeRoleByPageDate() throws Exception {
        PageData pd =this.getPageData();
        List<PageData> list = chainBasicPrivilegeRoleService.findPrivilegeRoleByPageDate(pd);
        return buildSuccMsg(list);
    }

    @ResponseBody
    @RequestMapping(value = "/selectPrivilegeByID")
    public ApiModel selectPrivilegeRoleByID() throws Exception {
        PageData pd =this.getPageData();
        pd = chainBasicPrivilegeRoleService.selectPrivilegeRoleByID(pd);
        //   pg.setPd(list);
        return buildSuccMsg(pd);
    }

    @ResponseBody
    @RequestMapping(value = "/updatePrivilegeRole")
    public ApiModel updatePrivilegeRole() throws Exception {
        PageData pd =this.getPageData();
        Integer result = chainBasicPrivilegeRoleService.updatePrivilegeRole(pd);
        //   pg.setPd(list);
        return buildSuccMsg(pd);
    }

    @ResponseBody
    @RequestMapping(value = "/insertPrivilegeRole")
    public ApiModel insertPrivilegeRole() throws Exception {
        PageData pd =this.getPageData();
        Integer result  = chainBasicPrivilegeRoleService.insertPrivilegeRole(pd);
        //   pg.setPd(list);
        return buildSuccMsg(pd);
    }


}
